package com.yanqu.road.entity.activity;

import com.yanqu.road.utils.LocalDateTimeHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 活动描述
 */
public class ActivityInfo {
	private int activityId;
	private String activityName;
	private String activityDesc;
	private int type;
	private int childType;
	private long beginShowTime;
	private long beginTime;
	private long endTime;
	private long endShowTime;
	private String icon;
	private int order;
	private String param1;
	private String param2;
	private String param3;
	private String param4;
	private String param5;
	private String param6;
	private String serverListStr;
	private List<Long> serverIdList = new ArrayList<>();

	//这里额外增加的区服配置，在跨服宴会中，代表指定的赴宴范围；
	private String serverListStr2;

	private List<Long> serverIdList2 = new ArrayList<>();
	private Long crossId;

	//后台批次
	private long importBatch;

	// [ 商会活动分组参数 ]
	// 格式：分组数量|每组商会数量|开始分组时间（单位分钟）|分组完成时间（单位分钟）
	// 例：10|60|1440|1450，表示分10组，每组最多100个商会，分组时间为beginShowTime+1440分钟
	// 空字符串、null、0、1都表示分1组，按旧活动逻辑走
	private String unionGroup = "0";

	/**
	 * 万能活动道具数组，万能活动用
	 */
	private List<Integer> commonActivityItemList = new ArrayList<>();

	public int getActivityId() {
		return activityId;
	}

	public void setActivityId(int activityId) {
		this.activityId = activityId;
	}

	public String getActivityName() {
		return activityName;
	}

	public void setActivityName(String activityName) {
		this.activityName = activityName;
	}

	public String getActivityDesc() {
		return activityDesc;
	}

	public void setActivityDesc(String activityDesc) {
		this.activityDesc = activityDesc;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getChildType() {
		return childType;
	}

	public void setChildType(int childType) {
		this.childType = childType;
	}

	public long getBeginShowTime() {
		return beginShowTime;
	}

	public void setBeginShowTime(long beginShowTime) {
		this.beginShowTime = beginShowTime;
	}

	public long getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(long beginTime) {
		this.beginTime = beginTime;
	}

	public long getEndTime() {
		return endTime;
	}

	public void setEndTime(long endTime) {
		this.endTime = endTime;
	}

	public long getEndShowTime() {
		return endShowTime;
	}

	public void setEndShowTime(long endShowTime) {
		this.endShowTime = endShowTime;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public String getParam1() {
		return param1;
	}

	public void setParam1(String param1) {
		this.param1 = param1;
	}

	public String getParam2() {
		return param2;
	}

	public void setParam2(String param2) {
		this.param2 = param2;
	}

	public String getParam3() {
		return param3;
	}

	public void setParam3(String param3) {
		this.param3 = param3;
	}

	public String getParam4() {
		return param4;
	}

	public void setParam4(String param4) {
		this.param4 = param4;
	}

	public String getParam5() {
		return param5;
	}

	public void setParam5(String param5) {
		this.param5 = param5;
	}

	public String getParam6() {
		return param6;
	}

	public void setParam6(String param6) {
		this.param6 = param6;
	}

	public String getUnionGroup() {
		return unionGroup;
	}

	public void setUnionGroup(String unionGroup) {
		if (StringUtils.isNullOrEmpty(unionGroup)) {
			return; // 不能设置为空
		}
		this.unionGroup = unionGroup;
	}

	public String getServerListStr() {
		return serverListStr;
	}

	public void setServerListStr(String serverListStr) {
		this.serverListStr = serverListStr;
	}

	public List<Long> getServerIdList() {
		return new ArrayList<>(serverIdList);
	}

	public void setServerIdList(List<Long> serverIdList) {
		this.serverIdList = serverIdList;
	}

	public List<Integer> getCommonActivityItemList() {
		return commonActivityItemList;
	}

	public void setCommonActivityItemList(List<Integer> commonActivityItemList) {
		this.commonActivityItemList = commonActivityItemList;
	}

	public Long getCrossId() {
		return crossId;
	}

	public void setCrossId(Long crossId) {
		this.crossId = crossId;
	}

	public void timeZoneChange(int channelActivityTimeZone) {
		this.beginShowTime = LocalDateTimeHelper.convertTimeZone(this.beginShowTime, channelActivityTimeZone, true);
		this.beginTime = LocalDateTimeHelper.convertTimeZone(this.beginTime, channelActivityTimeZone, true);
		this.endTime = LocalDateTimeHelper.convertTimeZone(this.endTime, channelActivityTimeZone, true);
		this.endShowTime = LocalDateTimeHelper.convertTimeZone(this.endShowTime, channelActivityTimeZone, true);
	}

	public List<Long> getServerIdList2() {
		return serverIdList2;
	}

	public void setServerIdList2(List<Long> serverIdList2) {
		this.serverIdList2 = serverIdList2;
	}

	public String getServerListStr2() {
		return serverListStr2;
	}

	public void setServerListStr2(String serverListStr2) {
		this.serverListStr2 = serverListStr2;
		this.parseServerList();
	}

	public void parseServerList() {
		if (StringUtils.isNullOrEmpty(this.serverListStr2)) {
			this.serverListStr2 = this.serverListStr;
			this.serverIdList2 = this.serverIdList;
		} else {
			this.serverIdList2 = StringUtils.stringToLongList(this.getServerListStr2(), ",");
		}

	}

	public long getImportBatch() {
		return importBatch;
	}

	public void setImportBatch(long importBatch) {
		this.importBatch = importBatch;
	}
}
